package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	InquiryStatusEventNew           = "erp.InquiryStatusNew"
	InquiryStatusEventBeforeCreate  = "erp.InquiryStatusBeforeCreate"
	InquiryStatusEventBeforeUpdate  = "erp.InquiryStatusBeforeUpdate"
	InquiryStatusEventBeforeSave    = "erp.InquiryStatusBeforeCreate erp.InquiryStatusBeforeUpdate"
	InquiryStatusEventAfterCreate   = "erp.InquiryStatusAfterCreate"
	InquiryStatusEventAfterUpdate   = "erp.InquiryStatusAfterUpdate"
	InquiryStatusEventAfterSave     = "erp.InquiryStatusAfterCreate erp.InquiryStatusAfterUpdate"
	InquiryStatusEventDelete        = "erp.InquiryStatusDelete"
	InquiryStatusAccessControlEvent = "erp.InquiryStatusAccessControl"
)

func GetInquiryStatusConfig() *mgo.DocConfig {
	return InquiryStatus_Config
}

var InquiryStatus_Config *mgo.DocConfig

func init() {
	InquiryStatus_Config = NewInquiryStatusConfig()
}
func NewInquiryStatusConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.InquiryStatus",
		Fields: []string{
			"name", "sort", "l", "r", "level", "link", "parent", "children", "color", "background", "group", "step", "warn",
		},
		RelationFields: []string{
			"parent", "children",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"parent": {
				Config:     GetInquiryStatusConfig,
				DocName:    "InquiryStatus",
				JoinType:   "O",
				KeyInside:  "parentId",
				KeyOutSide: "id",
			},
			"children": {
				Config:     GetInquiryStatusConfig,
				DocName:    "InquiryStatus",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "parentId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
